package xyz.hujf.base.interrupted;

/**
 * @author Hujf
 * @title: Interrupted
 * @date 2021-04-2120:37
 * @description: interrupted 并不是真正的打断 而是设置了一个标志位，
 */
public class Interrupted {
    public static void main(String[] args) throws InterruptedException {
        Thread thread = new Thread(()->{
            for(;;){

            }
        });

        thread.start();


        thread.interrupt();

        System.out.println(thread.isInterrupted());

        System.out.println("Thread.interrupted() = " + Thread.interrupted());

        thread.join();

        System.out.println("main is over ");
    }
}
